import { Injectable } from '@angular/core';

import { Http, Response, Headers } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import { Car } from './car'; 

@Injectable()
export class CarService {

    constructor(private http: Http) { }

    getCarsSmall(): Observable<any[]> {
        return this.http.get('./assets/cars-small.json')
            .map(res => <Car[]>res.json().data)
            .catch(data => { return data; });
    }
}